package com.zzptc.lzh.myapp26.Fragment;

import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zzptc.lzh.myapp26.R;


public class SecondFragment extends Fragment {
    private TextView txtid,txtpsd;

    public SecondFragment() {
        // Required empty public constructor
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view=inflater.inflate(R.layout.fragment_second,container,false);
        initView(view);
        return view;

    }

    private void initView(View view) {
        txtid=view.findViewById(R.id.txtid);
        txtpsd=view.findViewById(R.id.txtpsd);
        SharedPreferences sp=getActivity().getSharedPreferences("userinfo",Context.MODE_PRIVATE);
        int uid=sp.getInt("userid",1);
        String usn=sp.getString("username","");
        String psd=sp.getString("password","1243");
        txtid.setText("你好,"+uid+"号用户"+usn);
        txtpsd.setText("你的密码是"+psd);
    }


}
